Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] product_template_multi_link: improve UX by searching templates on default_code #800

Merged

Conversation

sebalix
Copy link

@sebalix sebalix commented May 17, 2023

No description provided.

@sebalix sebalix force-pushed the 14-pt_multi_link-search_on_default_code branch from 133aafb to 9cba4e0 Compare May 17, 2023 12:07
# Reset 'name' so base '_name_search' won't add '_rec_name'
# to 'args' (already added above).
# See 'odoo.models.BaseModel._name_search'.
name = ""
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +112 to +118
# NOTE: Odoo limits the search on the name of templates as soon as
# the 'id' field is present in 'args' domain, and this 'id' criteria is
# set by the view on purpose to avoid a search on variants.
# Improve this search by looking also on template's default_code
# if there is only a domain on 'id'.
search_default_code = self.env.context.get("name_search_default_code")
if name and len(args or []) == 1 and args[0][0] == "id" and search_default_code:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@grindtildeath grindtildeath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@sebalix
Copy link
Author

sebalix commented Jul 17, 2023

Added another use case: search on templates with default codes of variants (like Odoo std behavior) as the default code of a template is empty as soon as it gets some variants.

),
]
)
# Reset 'name' so base '_name_search' won't add '_rec_name'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

@simahawk
Copy link

simahawk commented Jul 17, 2023

@sebalix pre-commit is not happy. And don't forget to squash on the next push 🙏

@sebalix sebalix force-pushed the 14-pt_multi_link-search_on_default_code branch from 81720ff to 6d6d7ff Compare July 17, 2023 12:33
@sebalix
Copy link
Author

sebalix commented Jul 17, 2023

@simahawk done

@simahawk
Copy link

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 14.0-ocabot-merge-pr-800-by-simahawk-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 46c29d5 into OCA:14.0 Jul 17, 2023
6 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 06f7a38. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants